#include "KWinSock.h"
#include "K_Winsock.h"
#include "KDebug.h"

KWinSock::KWinSock(int major, int minor, int *err)
{
    WSADATA data;
    int error = WSAStartup(MAKEWORD(major, minor), &data);
    if (error) {
        KDebugLib("WSAStartup() failed: %d", error);
    }
    if (err) {
        *err = error;
    }
}

KWinSock::~KWinSock()
{
    if (WSACleanup() == SOCKET_ERROR) {
        KDebugLib("WSACleanup() failed: %d", WSAGetLastError());
    }
}